package observer;

/**
 * Created with IntelliJ IDEA.
 * User: Alexander
 * Date: 09.07.12
 * Time: 15:46
 * To change this template use File | Settings | File Templates.
 */
public class StatisticDisplay implements Observer, Display {

    private float temperature;
    private float humidity;
    private float pressure;
    private Subject subject;

    public StatisticDisplay(Subject subj){
        this.subject = subj;
        subject.registerObserver(this);
    }

    public void update(float temp, float pressure, float humidity) {
        this.temperature = temp;
        this.pressure = pressure;
        this.humidity = humidity;
        display();
    }

    public void display() {
        System.out.println(temperature + " C - " + pressure + " Bar - " + humidity + " %.");

    }
}
